	
	var baseUrl = "";
	//当前显示第几页
	var currentPage=1;
	//一共多少页数据
	var totalPage;
	
	
	//新闻列表加载
	function readListData(id,currentPage){
		var data = {
				id : parseInt(id),
				currentPage :  parseInt(currentPage)
			};
		$.ajax({
			url:baseUrl+'/informationController/selectInformationListr',
			data :data,
			type : 'POST',
			dataType: "JSON",
			success : function(data) {
				var dataLists = null;
				if (data != null) {
					dataLists = data.dataList;
					var str="";
					if (dataLists != null) {
						//当前第几页
						currentPage=data.currentPage;
						//一共多少页数据
						totalPage=data.totalPage;
						var base = new Base64();
						for(var i=0;i<dataLists.length;i++){
							str+="<li>";
							str+="<div class=\"news_navList_img left\">";
							str+="<img src=\""+dataLists[i].imgurl+"\" title=\""+dataLists[i].title+"\" alt=\""+dataLists[i].alt+"\">";
							str+="</div>";
							str+="<div class=\"news_navList_text\">";
							str+="<h6>"+dataLists[i].name+"</h6>";
							str+="<p>"+analysisContent(base.decode(dataLists[i].content))+"</p>";
							str+="<a class=\"news_navList_detail\" href=\"/xwxq/"+dataLists[i].id+"\">了解更多</a>";
							str+="</div>";
							str+="</li>";
						}
						//构建分页信息
						loadPage(data);
					}else{
						$("#page").text("");
						str+="<div class=\"context_item\">";
						str+="<div class=\"notdata\">暂无数据</div>";
						str+="</div>";
					}
					$("#table_list").html(str); 
				}
			},
			error: function (result) {
			}
		});
	}
	
	var data_id = 0;
	//新闻点击切换效果
	$(".news_navTitle span").click(function(){
		$(this).addClass('news_navTitle_active').siblings().removeClass('news_navTitle_active');
		//加载列表
		data_id= $(this).attr("data-id");
		currentPage = 1;
		readListData(data_id,currentPage);
	})
	
	
		//构建分页信息
	function loadPage(data) {
		$("#page").text("");
		var pageStr = "";
		pageStr += "<li><a class=\"first\"></a></li>";
		pageStr += "<li><a class=\"prev\" id=\"prePage\">&lt;</a></li>";
		currentPage =  data.currentPage; 
		var startindex = data.currentPage;  //当前页数
		var endindex = data.totalPage;  //总页数
		var spacenumb = endindex - startindex;
		if (spacenumb > 5) {
			endindex = startindex + 4;
		} else {
			if (totalPage > 5) {
				startindex = totalPage - 4;
			} else {
				startindex = 1;
			}
		}
		for (var i = startindex; i <= endindex; i++) {
			if (data.currentPage == i) {  //active默认选中样式
				pageStr += "<li class=\"active\" data-num=\""+i+"\"><a>" + i + "</a></li>";
			} else {
				pageStr += "<li data-num=\""+i+"\"><a>" + i + "</a></li>";
			}
		}
		pageStr += "<li><a class=\"next\"  id=\"nextPage\">&gt;</a></li>";
		pageStr += "<li><a class=\"last\"></a></li>";
		$("#page").html(pageStr);
	}
	
	
		//上一页
	$(document).on("click","#prePage",function(){
		if(currentPage==1){
			alert("已经是第一页数据!");
			return false;
		}else{
			readListData(data_id,currentPage-1);
		}
	});

	//下一页
	$(document).on("click","#nextPage",function(){
		if(currentPage==totalPage){
			alert("已经是最后一页数据!");
			return false;
		}else{
			readListData(data_id,currentPage+1);
		}
	});
	
	//当前页数加载
	$(document).on("click","#page li",function(){
		var pageNum = $(this).attr("data-num");
		readListData(data_id,pageNum);
	})


	//判断为数据库null
	function isNull(reason){
		if(reason!=null&&reason!=""&&reason!="null"){
			return reason;
		}else{
			return "";
		}
	}
	
	
	//解析base64加密后的html文本并且判断长度大于多少进行截取
	function analysisContent(str){
		str = str.replace(/(\n)/g, "").replace(/(\t)/g, "").replace(/(\r)/g, "").replace(/<\/?[^>]*>/g, "").replace(/\s*/g, "").replace(/&nbsp;/ig, "");   //替换html基本标签
		if(str.length>40){		//判断字段如果过长截取字段长度返回展示
			str = str.substring(0,40)+"..."
		}
		return str;
	}
	
	
	
	

	